#include <stdio.h>
#include <math.h>
int main(int argc, char *argv[]) {

    double sum = 0;
    int num = 0, comp = 0;
    scanf("%d", &num);
    comp = num;

    while (num!=0)
    {
        int t = num % 10;
        sum += pow(t, 3);
        num /= 10;
    }

    if(sum==comp)
        printf("1");
    else
        printf("0");

    return 0;
}